package com.serviets;

import com.dao.LeaveDao;
import com.dao.impl.LeaveDaoimpl;
import com.dao.impl.LeaveDaoimpl;
import com.model.Book;
import com.model.Leave;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/leave.do")
public class LeaveServlet extends BaseServiets{
    private LeaveDao leaveDao=  new LeaveDaoimpl();

    protected  void addLeave(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取前端递交的删除数据
        int Id = Integer .parseInt(request.getParameter("Id"));
        System.out.println("Id = " + Id);

        String parameter = request.getParameter("leave_reasons");
        Leave leave = new Leave();
        leave.setLeave_id(Id);
        leave.setLeave_reasons("leave_reasons");
        System.out.println("获取下架书籍：leave = " + leave);

        leaveDao.addLeave(Id);
        request.getRequestDispatcher("book.do?operate=queryEmps").forward(request,response);


    }
}
